<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
	label.error{color:red}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>二级分类页面</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/common.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/ej_class.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/yhzx.css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.validate.js"></script>
<script type="text/javascript">
	$(function(){
		$("#form").validate({
			rules:{
				username:{
					required:true,
					rangelength:[2,8]
				},
				name:{
					required:true,
				},
				email:{
					required:true,
					email:true
				},
				phone:{
					required:true,
					digits:true,
				},
				addr:{
					required:true,
				},
				password1:{
					required:true,
					equalTo:"#pwd"
				},
				password2:{
					required:true,
					maxlength:16
				},
				password:{
					required:true,
					equalTo:"#password2"
				}
			},
			messages:{
				username:{
					required:"不能为空",
					rangelength:"请输入正确名称"
				},
				name:{
					required:"请输入姓名",
				},
				email:{
					required:"邮箱编码不能为空",
					email:"请输入正确的email格式"
				},
				phone:{
					required:"请输入电话号码",
					digits:"请输入整数数字"
				},
				addr:{
					required:"请输入地址",
				},
				password1:{
					required:"请输入原密码",
					equalTo:"输入密码与原密码不一致"
				},
				password2:{
					required:"请输入原密码",
					maxlength:"密码长度不得多于16位"
				},
				password:{
					required:"请输入密码",
					equalTo:"两次密码不一致"
				}
			}
		})
	})
	function updatePersonalMessage(){
		$.ajax({
			type:"post",
			url:"<%=request.getContextPath()%>/personal/updatePersonalMessage",
			data:{uid:$("#uid").val(),username:$("#username").val(),name:$("#name").val(),email:$("#email").val(),phone:$("#phone").val(),addr:$("#addr").val()},
			success:function(obj){
				alert("修改成功");
				location.href="<%=request.getContextPath()%>/personal/personalmessage?uid=${user.uid}";
			},
			dataType:"json"
		})
	}
	function updatePwdMessage(){
		$.ajax({
			type:"post",
			url:"<%=request.getContextPath()%>/personal/updatePwdMessage",
			data:{uid:$("#uid").val(),password:$("#password").val()},
			success:function(obj){
				alert("修改成功");
				alert("系统检测到您的密码已被更改，请重新登录！");
				location.href="<%=request.getContextPath()%>/user/toLogin";
			},
			dataType:"json"
		})
	}
</script>
</head>
<body>
<%@ include file="menu.jsp" %>

<div class="w_980 m">
	<form id="form">
	  <div class="pos fl_l ma_t10"><a href="#">首页</a> > <a href="#">礼品箱包、钟表首饰</a> > <a href="#">时尚男包</a> > BOSSSUNWEN博斯绅威男士横款钱包高档礼盒S9... </div>
	  <div class="w_980 fl_l">
		<div class="l_200">
	                <div class="yhzx">
	                	<h2>个人中心</h2>
	                    <ul>
	                    	<li><a href="<%=request.getContextPath()%>/welcome/yhzx_hyy?uid=${user.uid}">欢迎页</a></li>
	                        <li class="sel"><a href="<%=request.getContextPath()%>/personal/personalmessage?uid=${user.uid}">用户信息</a></li>
	                        <li><a href="<%=request.getContextPath()%>/order/personalOrder?uid=${user.uid}">我的订单</a></li>
	                        <li><a href="<%=request.getContextPath()%>/site/personalSite?uid=${user.uid}">收货地址</a></li>
	                        <li><a href="<%=request.getContextPath()%>/collect/personalCollect?uid=${user.uid}">我的收藏</a></li>
	                        <li><a href="<%=request.getContextPath()%>/leaveword/personalleave?uid=${user.uid}">我的留言</a></li>
	                        <li><a href="<%=request.getContextPath()%>/comment/personalcomment?uid=${user.uid}">我的评论</a></li>                                                                        
	                        <li><a href="<%=request.getContextPath()%>/personal/exit">安全退出</a></li>                              
	                    </ul>
	                </div>
			  </div>  
	  	<div class="w_770_bor">
	           	  <div class="yhzx_title">用户信息</div>
	              <div class="hyy fl_l">
	                <table width="80%" border="0" cellspacing="0" cellpadding="0" class="basic">
	                <!-- 日期设置   ，，  必学！！！ -->
	                  <!-- <tr>
	                    <td width="116" class="te_r">出生日期：</td>
	                    <td width="535"><select id="birth_year" onchange="setDays(this,birth_month,birth_day);"> 
	                      <option value="">年</option>
	                    </select>
	                     <select id="birth_month" onchange="setDays(birth_year,this,birth_day);">
	                        <option value="">月</option>
	                      </select>
	                      <select id="birth_day">  
	                        <option value="">日</option>
	                      </select></td>
	                  </tr> -->
	                  <tr>
	                    <td class="te_r">名称：</td>
	                    <td>
		                    <input name="uid" type="hidden" id="uid" value="${personalUser.uid }"/>
		                    <input name="username" type="text" id="username" value="${personalUser.username }"/>
	                    </td>
	                  </tr>
	                  <tr>
	                    <td class="te_r">真实姓名：</td>
	                    <td><label for="textfield"></label>
	                      <input type="text" name="name" id="name" value="${personalUser.name }" /></td>
	                  </tr>
	                  <tr>
	                    <td class="te_r">email：</td>
	                    <td><input type="text" name="email" id="email" value="${personalUser.email }" /></td>
	                  </tr>
	                  <tr>
	                    <td class="te_r">phone：</td>
	                    <td><input type="text" name="phone" id="phone" value="${personalUser.phone }" /></td>
	                  </tr>
	                  <tr>
	                    <td class="te_r">地址：</td>
	                    <td>
	                    	<input type="text" name="addr" id="addr" value="${personalUser.addr }" /></td>
	                  </tr>
	                  <tr>
	                    <td colspan="2" class="te_m"><input type="button" value="确认修改" class="btn" onclick="updatePersonalMessage()" /></td>
	                  </tr>
	                  <tr>
	                    <td class="te_r">原密码：</td>
	                    <td><input type="password" name="password1" id="password1"/>
	                    	<input type="hidden" id="pwd" value="${personalUser.password }"/>
	                    </td>
	                  </tr>
	                  <tr>
	                    <td class="te_r">新密码：</td>
	                    <td><input type="password" name="password2" id="password2"/></td>
	                  </tr>
	                  <tr>
	                    <td class="te_r">确认密码：</td>
	                    <td><input type="password" name="password" id="password"/></td>
	                  </tr>
	                  <tr>
	                    <td colspan="2" class="te_m"><input type="button" value="确认修改" class="btn" onclick="updatePwdMessage()" /></td>
	                  </tr>
	                </table>
	        </div>
				</div>
	  </div>
	  <div class="w_980 fl_l ma_t10 te_m">关于我们 | 联系我们 | 人才招聘 | 商家入驻 | 广告服务 | 移动终端 | 友情链接 | 销售联盟 <br />
	    北京市公安局海淀分局备案编号：11010233381  京ICP证070的4523号 <br />
	    Copyright2004-2011  五金商城 版权所有</div>
	  <div class="w_980 fl_l ma_t10">
	    <ul class="footerpic">
	      <li><a href=" "><img src="<%=request.getContextPath()%>/images/footer_pic_04.gif" width="91" height="31" /></a></li>
	      <li><a href=" "><img src="<%=request.getContextPath()%>/images/footer_pic_05.gif" width="91" height="31" /></a></li>
	      <li><a href=" "><img src="<%=request.getContextPath()%>/images/footer_pic_06.gif" width="91" height="31" /></a></li>
	      <li><a href=" "><img src="<%=request.getContextPath()%>/images/footer_pic_07.gif" width="91" height="31" /></a></li>
	      <li><a href=" "><img src="<%=request.getContextPath()%>/images/footer_pic_09.gif" width="91" height="31" /></a></li>
	      <li><a href=" "><img src="<%=request.getContextPath()%>/images/footer_cnnic.jpg" width="91" height="31" /></a></li>
	    </ul>
	  </div>
	 </form>
</div>
</body>
</html>
